find the time complexity of an algorithm